package com.lookme.lmtool.cracker.filter.edge;

import com.jhlabs.image.ContourFilter;
import com.jhlabs.image.SolarizeFilter;
import com.lookme.lmtool.cracker.CrackerConstants;
import com.lookme.lmtool.cracker.annotation.FilterAnnotation;
import com.lookme.lmtool.cracker.annotation.ParamAnnotation;
import com.lookme.lmtool.cracker.filter.AbstractFilter;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

import java.awt.image.BufferedImageOp;

@FilterAnnotation(groupName = CrackerConstants.FILTER_GROUP_NAME_EDGE,name="轮廓",filterClass = SolarizeFilter.class)
public class FilterContour extends AbstractFilter {

    @XStreamAsAttribute
    @ParamAnnotation(name = "等级", desc = "等级",inputType = ParamAnnotation.InputType.Spinner)
    float levels=1;

    @XStreamAsAttribute
    @ParamAnnotation(name = "比例", desc = "比例",inputType = ParamAnnotation.InputType.Spinner)
    float scale=1;

    @XStreamAsAttribute
    @ParamAnnotation(name = "偏移量", desc = "偏移量",inputType = ParamAnnotation.InputType.Spinner)
    float offset =1;

    @XStreamAsAttribute
    @ParamAnnotation(name = "轮廓颜色", desc = "轮廓颜色",inputType = ParamAnnotation.InputType.ColorPicker)
    int contourColor=0xffffffff;

    @Override
    public BufferedImageOp getFilter() {
        ContourFilter filter= new ContourFilter();
        filter.setLevels(levels);
        filter.setScale(scale);
        filter.setOffset(offset);
        filter.setContourColor(contourColor);
        return filter;
    }


}
